import React, { Component } from 'react';
import { Switch, Route, Redirect } from 'react-router-dom'
import routes from '../../pages'

class componentName extends Component {
    render() {
        let arr = routes.map(ele => {
            return ele.children ? ele.children.map(item => (
                <Route path={item.path} component={item.component}></Route>
            )) : ''
        })
        return (
            <div className='context'>
                <Switch>
                    {arr}
                    <Redirect from='/*' to='/home'></Redirect>
                </Switch>
            </div>
        );
    }
}

export default componentName;